import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LayerVO, LayerForm, LayerQuery } from '@/api/biz/layer/types';

/**
 * 查询重点防护与基础设施列表
 * @param query
 * @returns {*}
 */

export const listLayer = (query?: LayerQuery): AxiosPromise<LayerVO[]> => {
  return request({
    url: '/biz/layer/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询重点防护与基础设施详细
 * @param id
 */
export const getLayer = (id: string | number): AxiosPromise<LayerVO> => {
  return request({
    url: '/biz/layer/' + id,
    method: 'get'
  });
};

/**
 * 新增重点防护与基础设施
 * @param data
 */
export const addLayer = (data: LayerForm) => {
  return request({
    url: '/biz/layer',
    method: 'post',
    data: data
  });
};

/**
 * 修改重点防护与基础设施
 * @param data
 */
export const updateLayer = (data: LayerForm) => {
  return request({
    url: '/biz/layer',
    method: 'put',
    data: data
  });
};

/**
 * 删除重点防护与基础设施
 * @param id
 */
export const delLayer = (id: string | number | Array<string | number>) => {
  return request({
    url: '/biz/layer/' + id,
    method: 'delete'
  });
};
